package com.company.learning.singleton;

/**
 * @Author: zhaoqi
 * @Date: 8/25/2019 6:06 PM
 * @Version 1.0
 */
// 双重检查锁的单例模式  volaile
public class Singleton3 {
    private static volatile Singleton3 singleton3;
    private Singleton3(){}

    public static Singleton3 getInstance(){
        if (null == singleton3){
            synchronized (Singleton3.class){
                if (null == singleton3){
                    singleton3 = new Singleton3();
                }
            }
        }
        return singleton3;
    }

}
